
		
/***************************************************************/
module hl_laser_top(
	//system clock 50MHz
	input				clk_in,
	input				rstn_in,							
	//LASER ALARMS INPUT
    input               VOLT_ALARM,
	input				TEMP_ALARM,//high is alarm
    input               TEMP_SEL,
	input				PD_ALARM,//high is ok
    //BLUE LASER interface
    input               BLUE_PWM,
    input               BLUE_SW,
	//RED LASER interface		
	input	[7:0]		POWER,	//p1-8 power bus
	input				P9_LATCH,	//power latch
	input				P18_EE,		
	input				P19_EM,
	input				P20_SYNC,	//sync				
	input				P22_RED,	//red ld enable
	input				P23_ESTOP,	//estop enable
	
	output				P16_PD_ALARM,	
	output				P21_TEMP_ALARM,									
	//DAC interface
	output				DAC1_SW,
	output				DAC1_CLK,
	output	[13:0]		DAC1_DATA,	
	output				DAC2_SW,
	output				DAC2_CLK,
	output	[13:0]		DAC2_DATA,	
	output				DAC3_SW,
	output				DAC3_CLK,
	output	[13:0]		DAC3_DATA,				
	//Pulse width output		
	output				RFA_out,	
	output				RED_out,
	output				PUMP_EN1,
	output				PUMP_EN2,	
	output				PUMP_EN3,
    output              BLUE_PWR_SEL,
	output              MO_LED,
	output              BO_LED,
	output				PD_LED,
	output				TEMP_LED	
);
	
/*****************RESET/CLOCK GEN******************/
wire            sys_clk;
wire            rst_n;

Gowin_PLLO  pll(
    .lock       (rst_n), //output lock
    .clkouta    (sys_clk), //output clkouta
    .clkin      (clk_in), //input clkin
    .dta        (4'd0) //input [3:0] dta
);
				
/*********************************************************************/		
laser_ctrl  laser_ctrl(
	.clk			    (sys_clk),
	.rst_n			    (rst_n),
	//output control
	.RED_out			(RED_out),
	.RFA_out	        (RFA_out),
    //BLUE LASER interface
    .BLUE_PWM           (BLUE_PWM),
    .BLUE_SW            (BLUE_SW),
	//RED LASER interface			
	//DB25 LOGIC PORTS
	.POWER		        (POWER),  // power bus
	.P9_LATCH			(P9_LATCH),	 // power latch
	.P18_EE				(P18_EE),	 // P18_EE						
	.P19_EM				(P19_EM),	 // P19_EM						
	.P20_SYNC			(P20_SYNC),	 // sync						
	.P22_RED			(P22_RED),	 // P22_RED				
	.P23_ESTOP			(P23_ESTOP),	 // P23_ESTOP																	
	//SENSOR DETECT IN
    .VOLT_ALARM         (VOLT_ALARM),
	.TEMP_ALARM			(TEMP_ALARM),
    .TEMP_SEL           (TEMP_SEL),
	.PD_ALARM			(PD_ALARM),	

	.DAC1_SW		    (DAC1_SW),
	.DAC1_CLK			(DAC1_CLK),
	.DAC1_DATA			(DAC1_DATA),
	.DAC2_SW		    (DAC2_SW),
	.DAC2_CLK			(DAC2_CLK),
	.DAC2_DATA			(DAC2_DATA),
	.DAC3_SW		    (DAC3_SW),
	.DAC3_CLK			(DAC3_CLK),
	.DAC3_DATA			(DAC3_DATA),

	.PUMP_EN1		    (PUMP_EN1),		
	.PUMP_EN2	        (PUMP_EN2),	
	.PUMP_EN3	        (PUMP_EN3),	
    .BLUE_PWR_SEL       (BLUE_PWR_SEL),
	.P16_PD_ALARM	    (P16_PD_ALARM),	
	.P21_TEMP_ALARM	    (P21_TEMP_ALARM),
	.MO_LED             (MO_LED),
	.BO_LED             (BO_LED),
	.PD_LED				(PD_LED),
	.TEMP_LED			(TEMP_LED)
);	
	
endmodule 